# Tuxlocator reperion sync deamon
# (c) 2007 by Rein Velt / http://geo.velt.org
# Published under the terms and conditions
# of the General Public License (GPL)

username="rein"
password="20dromedaris"

while true
do
   gpsSignalValid="`cat /var/gps_valid`"
   case $gpsSignalValid in
   	A)	#signal OK
		longitude="`cat /var/gps_longitude_dd`"
   		latitude="`cat /var/gps_latitude_dd`"
   		altitude="`cat /var/gps_altitude`"
   		speed="`cat /var/gps_speed`"
   		course="`cat /var/gps_heading`"
   		gpsrecord="`echo $username $password $latitude $longitude $altitude $speed $course`"
   		trackerUrl="`echo $gpsrecord | awk '{ printf("http://tracker1.reperion.com/webform1.aspx?name=%s&username=%s&passwd=%s&latitude=%s&longitude=%s&alt=%1.2f&speed=%1.0f&crs=%1.0f",$1,$1,$2,$3,$4,$5,$6,$7) }'`"
   		echo Loading $trackerUrl
   		/usr/bin/wget -O /var/sync_status $trackerUrl
		;;
   esac
   sleep 30
done
